<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>首页</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Your description"/>
    <meta name="keywords" content="Your keywords"/>
    <meta name="author" content="Your name"/>

    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>

<!-- head 头部 -->
<div id="head" th:include="common/index_header :: copyheader"></div>
<div id="slider_wrapper">
    <div class="container">
        <div id="slider_inner">
            <div id="slider">
                <div class="carousel-box">
                    <div class="inner">
                        <div class="carousel main">
                            <ul>
                                <li th:each="carousel : ${carousels}">
                                    <div class="slider">
                                        <div class="slider_inner">
                                            <div class="txt1"><span th:text="${carousel.title}"></span></div>
                                            <div class="txt2"><span th:text="${carousel.comment}"></span></div>
                                            <div class="txt3"><span th:text="${carousel.scenictime}"></span></div>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="slider_pagination"></div>
            </div>
        </div>
    </div>
</div>
<!--</div>-->

<div id="front_tabs">
    <div class="container">
        <div class="tabs_wrapper tabs1_wrapper">
            <div class="tabs tabs1">
                <div class="tabs_tabs tabs1_tabs">
                    <ul>
                        <li class="active flights"><a href="#tabs-1" onclick="getArticle(null)">最新动态</a></li>
                        <li class="active flights"><a href="#tabs-2" onclick="getArticle('scenic')">景点</a></li>
                        <li class="active flights"><a href="#tabs-3" onclick="getArticle('hotel')">酒店</a></li>
                    </ul>
                </div>
                <div class="tabs_content tabs1_content">
                    <div id="tabs-1">
                     <ul id="ul1"></ul>
                    </div>
                    <div id="tabs-2">
                        <ul id="ul2"></ul>
                    </div>
                    <div id="tabs-3">
                        <ul id="ul3"></ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="popular_cruises1">
    <div class="container">

        <h2 class="animated">推荐游览</h2>

        <div class="title1 animated">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
            euismod <br>tincidunt ut laoreet dolore magna aliquam erat volutpat.
        </div>

        <br><br>

        <div id="popular_wrapper" class="animated" data-animation="fadeIn" data-animation-delay="300">
            <div id="popular_inner">
                <div class="">
                    <div id="popular">
                        <div class="">
                            <div class="carousel-box">
                                <div class="inner">
                                    <div class="carousel main">
                                        <ul id="ul6">

                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="popular_pagination"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id="partners">
    <div class="container">
        <div class="row">
            <div class="col-sm-4 col-md-2 col-xs-6">
                <div class="thumb1 animated">
                    <div class="thumbnail clearfix">
                        <a href="#">
                            <figure>
                                <img th:src="@{/images/partner1.jpg}" src="images/partner1.jpg" alt=""
                                     class="img1 img-responsive">
                                <img th:src="@{/images/partner1_hover.jpg}" src="images/partner1_hover.jpg" alt=""
                                     class="img2 img-responsive">
                            </figure>
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-sm-4 col-md-2 col-xs-6">
                <div class="thumb1 animated">
                    <div class="thumbnail clearfix">
                        <a href="#">
                            <figure>
                                <img th:src="@{/images/partner2.jpg}" src="images/partner2.jpg" alt=""
                                     class="img1 img-responsive">
                                <img th:src="@{/images/partner2_hover.jpg}" src="images/partner2_hover.jpg" alt=""
                                     class="img2 img-responsive">
                            </figure>
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-sm-4 col-md-2 col-xs-6">
                <div class="thumb1 animated">
                    <div class="thumbnail clearfix">
                        <a href="#">
                            <figure>
                                <img th:src="@{/images/partner3.jpg}" src="images/partner3.jpg" alt=""
                                     class="img1 img-responsive">
                                <img th:src="@{/images/partner3_hover.jpg}" src="images/partner3_hover.jpg" alt=""
                                     class="img2 img-responsive">
                            </figure>
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-sm-4 col-md-2 col-xs-6">
                <div class="thumb1 animated">
                    <div class="thumbnail clearfix">
                        <a href="#">
                            <figure>
                                <img th:src="@{/images/partner4.jpg}" src="images/partner4.jpg" alt=""
                                     class="img1 img-responsive">
                                <img th:src="@{/images/partner4_hover.jpg}" src="images/partner4_hover.jpg" alt=""
                                     class="img2 img-responsive">
                            </figure>
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-sm-4 col-md-2 col-xs-6">
                <div class="thumb1 animated">
                    <div class="thumbnail clearfix">
                        <a href="#">
                            <figure>
                                <img th:src="@{/images/partner5.jpg}" src="images/partner5.jpg" alt=""
                                     class="img1 img-responsive">
                                <img th:src="@{/images/partner5_hover.jpg}" src="images/partner5_hover.jpg" alt=""
                                     class="img2 img-responsive">
                            </figure>
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-sm-4 col-md-2 col-xs-6">
                <div class="thumb1 animated">
                    <div class="thumbnail clearfix">
                        <a href="#">
                            <figure>
                                <img th:src="@{/images/partner6.jpg}" src="images/partner6.jpg" alt=""
                                     class="img1 img-responsive">
                                <img th:src="@{/images/partner6_hover.jpg}" src="images/partner6_hover.jpg" alt=""
                                     class="img2 img-responsive">
                            </figure>
                        </a>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!--底部-->
<div th:include="common/index_footer :: copyfooter"></div>
</body>


<script>
    function travel() {
        window.location.href="/dist/travel"
    }

    window.onload =function() {
        getArticle(null);
        getRecommend()
    }


    function  getRecommend(){
        var data = JSON.stringify({articleType:'scenic',status:1})
        $.ajax({
            type: "post",
            url: "/article/search/1/3",
            contentType: "application/json",
            dataType:"JSON",
            data:data,
            success:function(result){
                html="";
                console.log(result)
                $.each(result.data.rows,function (index,value) {
                    html=html+"<li><div class='popular'><div class='popular_inner'><figure><img src="+ value.picture+" style='width: 180px;height: 180px' class='img-responsive'><div class='over'><div class='v1'>"+value.topic+"<span>17 Deal Offers</span>\n"+
                        "</div><div class='v2'>Lorem ipsum dolor sit amet, concateus.</div></div></figure><div class='caption'><div class='txt1'><span>"+ value.topic+"</span></div>\n" +
                        " <div class='txt2'>"+ value.content+"</div><div class='txt3 clearfix'><div class='right_side'><a href=\"#\" onclick='detail("+value.id+")' class='btn-default btn1'>查看</a></div>\n" +
                        "</div></div></div></div></li>"
                })
                console.log(html)
                $("#ul6").html(html)
            },
            error:function () {
                alert('请求失败！');
            }
        })

    }




    function  getArticle(type){
        var data = JSON.stringify({articleType:type,status:1})
        $.ajax({
            type: "post",
            url: "/article/search/1/10",
            contentType: "application/json",
            dataType:"JSON",
            data:data,
            success:function(result){
                html=""
                $.each(result.data.rows,function (index,value) {
                    console.log(value)
                    html=html+"<li><a href='#' onclick='detail(\""+value.id+"\")'>"+value.topic+"</a></li>";
                })
                console.log(type)
                if(type == null)
                {
                    console.log(111)
                    $("#ul3").html('')
                    $("#ul2").html('')
                    $("#ul1").html(html)

                }else if (type =='scenic') {
                    console.log(222)
                    $("#ul3").html('')
                    $("#ul1").html('')

                    $("#ul2").html(html)

                }else{
                    console.log(333)
                    $("#ul2").html('')
                    $("#ul1").html('')
                    $("#ul3").html(html)
                }
            },
            error:function () {
                alert('请求失败！');
            }
        })

    }


    function detail(id)
    {
        window.location.href="/dist/articleDetail?id="+id;
    }


</script>

</html>